﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calculate ActiveX</title>
<script type="text/javascript">
    function Calc() {
        var active = document.getElementById("csharpActiveX");
        if (active != null) {
            var a = document.getElementById("txta").value;
            var b = document.getElementById("txtb").value;
            var CalcType = document.getElementById("selCalc").value;
            switch (CalcType) {
                case "Add": document.getElementById("txt").value = active.Add(a, b); break;
                case "Minus": document.getElementById("txt").value = active.Minus(a, b); break;
                case "Multiply": document.getElementById("txt").value = active.Multiply(a, b); break;
                case "Divide": document.getElementById("txt").value = active.Divide(a, b); break;
                default: break;
            }
        }
    }
</script>
</head>
<body>
    <object id="csharpActiveX" classid="clsid:D25650E2-730D-42f0-A4C5-8A52C97C86FB" codebase="ActiveX/setup.exe"></object>
    <input id="txta" type="text" />
    <select id="selCalc">
        <option value="Add">+</option>
        <option value="Minus">-</option>
        <option value="Multiply">*</option>
        <option value="Divide">/</option>
    </select>
    <input id="txtb" type="text" />
    <input type="button" onclick="Calc()" value="=" />
    <input id="txt" type="text" />
</body>
</html>
